cmake_minimum_required(VERSION 3.16)
project(hello)

# set the output directory for built objects.
# This makes sure that the dynamic library goes into the build directory automatically.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")

# This assumes the SDL source is available in vendored/SDL
add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL)
# This assumes vulkan sdk is installed
if(NOT DEFINED ENV{VULKAN_SDK})
    message(FATAL_ERROR "VULKAN_SDK environment variable is not set.")
endif()
set(VULKAN_SDK $ENV{VULKAN_SDK})
list(APPEND CMAKE_PREFIX_PATH "${VULKAN_SDK}")
find_package(Vulkan REQUIRED)
if(NOT Vulkan_FOUND)
    message(FATAL_ERROR "Failed to find Vulkan.")
endif()
include_directories(${Vulkan_INCLUDE_DIRS})
link_directories(${Vulkan_LIBRARY})


# Create your game executable target as usual
add_executable(hello WIN32 src/hello.c)

# Link to the actual SDL3 library.
target_link_libraries(hello PRIVATE SDL3::SDL3)
target_link_libraries(hello ${VULKAN_LIBRARIES})